<?php
namespace Cyfy\Modules\SiteInformation;

/**
 * Information about site. Title, contact email, URL.
 * @author Dandelion
 * @version 0.1
 */
class Module extends \Cyfy\Module
{
    
    /**
     * Administration UI
     * @return mixed
     */
    static function administration($name = "")
	{
		switch($name)
        {
            case "settings":
                $form = new Forms\Settings();
                $form -> setDataFromConstants(array("title", "url", "email", "name", "author"));
                return $form -> show();
            
            case "":
                return array(
                    "settings" => array("name" => self :: t(70), "description" => self ::t(170), "permission"=> "administration"),
                );
         
            default:
                return false;
		}	
	}
    
    
    /**
     * Sets title and author meta tag, when cyfy starts.
     */
    static function start()
    {
        if(self :: constant("title"))
        {
            \Cyfy\Template :: setTitleBase(self :: constant("title"));
        }
        
        if(self :: constant("author"))
        {
            \Cyfy\Template :: addHeader("<meta name=\"author\" content=\"" . self :: constant("author") . "\" />");
        }
    }
}